<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增实有房屋登记信息')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-house-add" th:object="${base}">
            <input name="dzbm" th:field="*{dzbm}" type="hidden" required>
            <input name="sssj" th:field="*{sssj}" type="hidden">
            <input name="ssfxj" th:value="${base.ssfj}" type="hidden">
            <input name="sspcs" th:field="*{sspcs}" type="hidden">
            <input name="sszrq" th:value="${base.ssjwq}" type="hidden">
            <input name="djdwGajgjgdm" th:field="*{djdwGajgjgdm}" type="hidden">
            <input name="ssjlxxqDzbm" th:field="*{ssjlxxqDzbm}" type="hidden">
            <input name="djrZh" th:field="*{djrZh}" type="hidden">
            <input name="zxdhzb" th:field="*{zxdhzb}" type="hidden">
            <input name="zxdzzb" th:field="*{zxdzzb}" type="hidden">
            <input name="sssqjwwgDzbm" th:field="*{sssqjwwgDzbm}" type="hidden">
            <input name="sssqjcwgDzbm" th:field="*{sssqjcwgDzbm}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">地址名称：</label>
                <div class="col-sm-8">
                    <input name="dzmc" th:field="*{dzmc}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">使用形式：</label>
                <div class="col-sm-8">
                    <select name="syxs" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_SYXS')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">房屋用途：</label>
                <div class="col-sm-8">
                    <select name="fwytdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_FWYT')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">房屋类别：</label>
                <div class="col-sm-8">
                    <select name="fwlbdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_FWLB')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">房屋性质：</label>
                <div class="col-sm-8">
                    <select name="fwcqxzzldm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_FWXZ')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房屋间数：</label>
                <div class="col-sm-8">
                    <input name="fwjs" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房屋面积：</label>
                <div class="col-sm-8">
                    <input name="fwmjMjpfm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房屋产权证号：</label>
                <div class="col-sm-8">
                    <input name="fwcqzh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主人口编码：</label>
                <div class="col-sm-8">
                    <input name="fzRkbm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主公民身份号码：</label>
                <div class="col-sm-8">
                    <input name="fzGmsfhm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主姓名：</label>
                <div class="col-sm-8">
                    <input name="fzXm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主证件种类：</label>
                <div class="col-sm-8">
                    <select name="fzCyzjdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主证件号码：</label>
                <div class="col-sm-8">
                    <input name="fzZjhm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主外文姓：</label>
                <div class="col-sm-8">
                    <input name="fzWwx" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主外文名：</label>
                <div class="col-sm-8">
                    <input name="fzWwm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房主联系电话：</label>
                <div class="col-sm-8">
                    <input name="fzLxdh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人人口编码：</label>
                <div class="col-sm-8">
                    <input name="tgrRkbm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人公民身份号码：</label>
                <div class="col-sm-8">
                    <input name="tgrGmsfhm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人姓名：</label>
                <div class="col-sm-8">
                    <input name="tgrXm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人证件种类：</label>
                <div class="col-sm-8">
                    <select name="tgrCyzjdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人证件号码：</label>
                <div class="col-sm-8">
                    <input name="tgrZjhm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人外文姓：</label>
                <div class="col-sm-8">
                    <input name="tgrWwx" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人外文名：</label>
                <div class="col-sm-8">
                    <input name="tgrWwm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">托管人联系电话：</label>
                <div class="col-sm-8">
                    <input name="tgrLxdh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">与房主关系：</label>
                <div class="col-sm-8">
                    <select name="tgrYfzgxRygxdm" class="form-control m-b" th:with="type=${@dict.getParamValue('T_PEO_RELATION')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">登记单位_公安机关名称：</label>
                <div class="col-sm-8">
                    <input name="djdwGajgmc" th:field="*{djdwGajgmc}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">登记人姓名：</label>
                <div class="col-sm-8">
                    <input name="djrXm" th:field="*{djrXm}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">登记时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="djsj" th:value="${#dates.format(base.djsj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">更新账户：</label>
                <div class="col-sm-8">
                    <input name="gxrZh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">更新部门：</label>
                <div class="col-sm-8">
                    <input name="gxbm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">核录部门：</label>
                <div class="col-sm-8">
                    <input name="hlbm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">核录时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="hlsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">核录人：</label>
                <div class="col-sm-8">
                    <input name="hlr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">核录标识：</label>
                <div class="col-sm-8">
                    <select name="hlbz" class="form-control m-b" th:with="type=${@dict.getParamValue('YBSS_HLBZ')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">数据来源：</label>
                <div class="col-sm-8">
                    <select name="sjly" class="form-control m-b" th:with="type=${@dict.getParamValue('YBSS_SJLY')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}" th:field="${base.sjly}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">标签：</label>
                <div class="col-sm-8">
                    <input name="bq" th:value="${bq}" type="hidden">
                    <input id="labelName" th:value="${labelNames}" class="form-control" type="text" readonly>
                    <div id="tree" class="ztree" style="border: 1px solid #e5e6e7"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">互联网审核人：</label>
                <div class="col-sm-8">
                    <input name="hlwshr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">互联网审核时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="hlwshsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="zxsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销账号：</label>
                <div class="col-sm-8">
                    <input name="zxzh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销时间标志：</label>
                <div class="col-sm-8">
                    <input name="zxsjbz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">推送状态：</label>
                <div class="col-sm-8">
                    <input name="tszt" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审批人：</label>
                <div class="col-sm-8">
                    <input name="spr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审批时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="spsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销原因：</label>
                <div class="col-sm-8">
                    <input name="zxyy" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否重点：</label>
                <div class="col-sm-8">
                    <select name="sfzd" class="form-control m-b"
                            th:with="type=${@dict.getParamValue('SFZD_DQJC')}">
                        <option th:each="dict : ${type}"
                                th:text="${dict.itemText}"
                                th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label ">是否定期检查：</label>
                <div class="col-sm-8">
                    <select id="dqjc" name="sfdqjc" onchange="gradeChange()" class="form-control m-b"
                            th:with="type=${@dict.getParamValue('SFZD_DQJC')}">
                        <option th:each="dict : ${type}"
                                th:text="${dict.itemText}"
                                th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group" id="szjczq" style="visibility:hidden">
                <!--document.getElementById("szjczq").style.visibility="hidden";
                document.getElementById("szjczq").style.visibility="visible";-->
                <label class="col-sm-3 control-label">检查周期（天）：</label>
                <div class="col-sm-8">
                    <input name="jczq" class="form-control" type="number" oninput="value=value.replace(/[^\d]/g,'')">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: ztree-js" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "control/house"

        $("#form-house-add").validate({
            focusCleanup: true
        });
        function gradeChange(){
            var $sfdqjc=$('#dqjc option:selected');
            if($sfdqjc.val() == "Y"){
                document.getElementById("szjczq").style.visibility="visible";
            }else {
                document.getElementById("szjczq").style.visibility="hidden";
            }
        }
        $(function() {
            var url = ctx + "control/label/treeData";
            var options = {
                id: "tree",
                url: url,
                check: { enable: true },
                expandLevel: 0,
                onCheck: onCheck
            };
            $.tree.init(options);
        });
        function onCheck() {
            $('input[name="bq"]').val(getChecked('id'));
            $('#labelName').val(getChecked('name'));
        }
        function getChecked(column) {
            var nodes = $._tree.getCheckedNodes(true);
            return $.map(nodes, function (row) {
                if(!row.isParent){
                    return row[column]
                }
            }).join();
        }

        function submitHandler() {
            if ($.validate.form()) {
                save(prefix + "/add", $('#form-house-add').serialize(), function (res) {
                    if(res.success){
                        $.modal.close();
                        parent.closeNowTab();
                        window.parent.$.modal.openTab("实有房屋", $.common.setURL("/control/house"));
                    }
                });
            }
        }

        function save(url, data, callback) {
            var config = {
                url: url,
                type: "post",
                dataType: "json",
                data: data,
                beforeSend: function (request) {
                    request.setRequestHeader("X-Access-Token", storage.get("token"));
                },
                success: function(result) {
                    callback(result);
                }
            };
            $.ajax(config)
        }

        $("input[name='djsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='hlsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='hlwshsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='zxsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='spsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>
